﻿Imports System.Collections.ObjectModel
Imports EHaskins.Frc.Dashboard
Imports System.ComponentModel
Imports EHaskins.Frc.Infrastructure
Public Class OIModuleViewModel
    Implements INotifyPropertyChanged
    Implements IOIModuleViewModel

    Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged

    Dim _joysticks As ObservableCollection(Of Joystick)
    Dim _dashboard As IDashboardController
    Dim _view As OIDashboardView

    Public Sub New(ByVal view As OIDashboardView, ByVal oiProcessor As IOiDataProcessor)
        _joysticks = oiProcessor.Joysticks
        _view = view
        Me.View.DataContext = Me
    End Sub

    Public Property Joysticks() As ObservableCollection(Of Joystick) Implements IOIModuleViewModel.Joysticks
        Get
            Return _joysticks
        End Get
        Set(ByVal value As ObservableCollection(Of Joystick))
            If _joysticks Is value Then
                Return
            End If
            _joysticks = value
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("Joysticks"))
        End Set
    End Property
    Public Property View() As OIDashboardView Implements IOIModuleViewModel.View
        Get
            Return _view
        End Get
        Set(ByVal value As OIDashboardView)
            _view = value
        End Set
    End Property

    Private _header As String = "Joystick Viewer"
    Public Property Header() As String
        Get
            Return _header
        End Get
        Set(ByVal Value As String)
            _header = Value
        End Set
    End Property
End Class
